<!--

    Copyright (c) 2010-2025 Eclipse Dirigible contributors

    All rights reserved. This program and the accompanying materials
    are made available under the terms of the Eclipse Public License v2.0
    which accompanies this distribution, and is available at
    http://www.eclipse.org/legal/epl-v20.html

    SPDX-FileCopyrightText: Eclipse Dirigible contributors
    SPDX-License-Identifier: EPL-2.0

-->
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width">
	<title>Test Run</title>
	<link rel="stylesheet" href="//code.jquery.com/qunit/qunit-2.0.1.css">
</head>
<body ng-app="test" ng-controller="testController">

	<div id="qunit">
		<h1 id="qunit-header"><a href="tests_dashboard.html">Test Dashboard</a> </h1>
		<h2 id="qunit-banner" class="qunit-pass"></h2>
<!--		<div id="qunit-testrunner-toolbar"><span class="qunit-url-config"><label for="qunit-urlconfig-hidepassed" title="Only show tests and assertions that fail. Stored as query-strings."><input id="qunit-urlconfig-hidepassed" name="hidepassed" type="checkbox" title="Only show tests and assertions that fail. Stored as query-strings.">Hide passed tests</label><label for="qunit-urlconfig-noglobals" title="Enabling this will test if any test introduces new properties on the global object (`window` in Browsers). Stored as query-strings."><input id="qunit-urlconfig-noglobals" name="noglobals" type="checkbox" title="Enabling this will test if any test introduces new properties on the global object (`window` in Browsers). Stored as query-strings.">Check for Globals</label><label for="qunit-urlconfig-notrycatch" title="Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."><input id="qunit-urlconfig-notrycatch" name="notrycatch" type="checkbox" title="Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings.">No try-catch</label></span><form id="qunit-modulefilter"><label id="qunit-modulefilter-search-container">Module: <input id="qunit-modulefilter-search" placeholder="All modules" title="Type to filter list. Current selection:
		All modules"></label><div id="qunit-modulefilter-dropdown" style="display: none;"><span id="qunit-modulefilter-actions"><button style="display:none">Apply</button><button type="reset" style="display:none">Reset</button><label class="clickable checked"><input type="checkbox" checked="checked">All modules</label></span><ul id="qunit-modulefilter-dropdown-list"></ul></div></form><form class="qunit-filter"><label>Filter: <input type="text" name="filter" id="qunit-filter-input"></label> <button>Go</button></form><div class="clearfix"></div></div>-->
		<!--<h2 id="qunit-userAgent">QUnit 2.0.1; {{userAgent}}</h2>	-->	
		<p id="qunit-testresult" class="result">Tests completed in <span ng-bind="data.testSuite.runtime"></span> milliseconds.<br><span class='passed' ng-bind="data.testSuite.passed"></span> assertions of <span class='total' ng-bind="data.testSuite.total"></span> passed, <span class='failed' ng-bind="data.testSuite.failed"></span> failed.</p>		
		<ol id="qunit-tests">
			<li ng-class="test.failed?'fail':'pass'" ng-click="collapsed=!collapsed" ng-repeat="test in data.tests">
				<strong><span class="module-name" ng-if="test.module" ng-bind="test.module">: </span><span class="test-name" ng-bind="test.name"></span> <b class="counts">({{test.total}})</b></strong><span class="runtime">{{test.runtime}} ms</span>
				<ol class="qunit-assert-list" ng-class="{'qunit-collapsed':!collapsed}" ng-repeat="assertion in test.assertions">
					<li ng-class="assertion.result?'pass':'fail'"><span class="test-message" ng-bind="assertion.message"></span><span ng-show="assertion.runtime" class="runtime">@ {{assertion.runtime}} ms</span>
						<div ng-show="assertion.stack" ng-bind="assertion.stack"></div>
					</li>
				</ol>
			</li>
		</ol>
	</div>

	<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
	<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.js"></script>
	<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular-resource.min.js"></script>	

	<script>
		angular.module('test', ['ngResource'])
		.service('TestRunnerSvc', ['$resource', '$window', function($resource, $window) {
			var testsUrl;
			var testsUrlParams = $window.location.search.replace('?','').split("&")
							.filter(function(entry){
								var kv = entry.split('=');
								if(kv[0].trim().toLowerCase() === 'url'){
									return true;
								}
								return false;
							});
			if(testsUrlParams && testsUrlParams.length>0){
				testsUrl = decodeURIComponent(testsUrlParams[0]).split('=')[1].trim();
			}
			return $resource(testsUrl, {});
		}])
		.controller('testController', ['$scope', '$window', 'TestRunnerSvc', function($scope, $window, TestRunnerSvc) {
			TestRunnerSvc.get().$promise
			.then(function(data){
				$scope.data = data;
				$scope.userAgent = $window.navigator.userAgent;
			})
			.catch(function(err){
				console.error(err);
			});
		}]);
	</script>
</body>
</html>
